﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
					xmlns:Adorners="clr-namespace:BeeCoders.Tools.ControlCanvas.Adorners"
					xmlns:ControlCanvas="clr-namespace:BeeCoders.Tools.ControlCanvas">
  
        <ControlTemplate x:Key="MoveThumbTemplate"
                     TargetType="{x:Type Adorners:MoveThumb}">

            <Rectangle Fill="Transparent" />
        </ControlTemplate>

        <Style TargetType="{x:Type Shape}"
           x:Key="ThumbCorner">
            <Setter Property="SnapsToDevicePixels"
                Value="true" />
            <Setter Property="Stroke"
                Value="LightSlateGray" />
            <Setter Property="StrokeThickness"
                Value=".5" />
            <Setter Property="Width"
                Value="7" />
            <Setter Property="Height"
                Value="7" />
            <Setter Property="Margin"
                Value="-2" />
            <Setter Property="Fill">
                <Setter.Value>
                    <RadialGradientBrush Center="0.3, 0.3"
                                     GradientOrigin="0.3, 0.3"
                                     RadiusX="0.7"
                                     RadiusY="0.7">
                        <GradientStop Color="White"
                                  Offset="0" />
                        <GradientStop Color="DarkSlateGray"
                                  Offset="0.9" />
                    </RadialGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>

        <Style TargetType="{x:Type Adorners:ResizeChrome}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Adorners:ResizeChrome}">
                        <Grid>
                            <Grid Opacity="0"
                              Margin="-3">
                                <Adorners:ResizeThumb Height="3"
                                           Cursor="SizeNS"
                                           VerticalAlignment="Top"
                                           HorizontalAlignment="Stretch" />
                                <Adorners:ResizeThumb Width="3"
                                           Cursor="SizeWE"
                                           VerticalAlignment="Stretch"
                                           HorizontalAlignment="Left" />
                                <Adorners:ResizeThumb Width="3"
                                           Cursor="SizeWE"
                                           VerticalAlignment="Stretch"
                                           HorizontalAlignment="Right" />
                                <Adorners:ResizeThumb Height="3"
                                           Cursor="SizeNS"
                                           VerticalAlignment="Bottom"
                                           HorizontalAlignment="Stretch" />
                                <Adorners:ResizeThumb Width="7"
                                           Height="7"
                                           Margin="-2"
                                           Cursor="SizeNWSE"
                                           VerticalAlignment="Top"
                                           HorizontalAlignment="Left" />
                                <Adorners:ResizeThumb Width="7"
                                           Height="7"
                                           Margin="-2"
                                           Cursor="SizeNESW"
                                           VerticalAlignment="Top"
                                           HorizontalAlignment="Right" />
                                <Adorners:ResizeThumb Width="7"
                                           Height="7"
                                           Margin="-2"
                                           Cursor="SizeNESW"
                                           VerticalAlignment="Bottom"
                                           HorizontalAlignment="Left" />
                                <Adorners:ResizeThumb Width="7"
                                           Height="7"
                                           Margin="-2"
                                           Cursor="SizeNWSE"
                                           VerticalAlignment="Bottom"
                                           HorizontalAlignment="Right" />
                            </Grid>
                            <Grid IsHitTestVisible="False"
                              Opacity="1"
                              Margin="-3">
                                <Rectangle SnapsToDevicePixels="True"
                                       StrokeThickness="1"
                                       Margin="1">
                                    <Rectangle.Stroke>
                                        <LinearGradientBrush StartPoint="0, 0"
                                                         EndPoint="1, .3"
                                                         Opacity=".7">
                                            <GradientStop Color="SlateGray"
                                                      Offset="0" />
                                            <GradientStop Color="LightGray"
                                                      Offset=".5" />
                                            <GradientStop Color="SlateGray"
                                                      Offset="1" />
                                        </LinearGradientBrush>
                                    </Rectangle.Stroke>
                                </Rectangle>
                                <Ellipse Style="{StaticResource ThumbCorner}"
                                     HorizontalAlignment="Left"
                                     VerticalAlignment="Top" />
                                <Ellipse Style="{StaticResource ThumbCorner}"
                                     HorizontalAlignment="Right"
                                     VerticalAlignment="Top" />
                                <Ellipse Style="{StaticResource ThumbCorner}"
                                     HorizontalAlignment="Left"
                                     VerticalAlignment="Bottom" />
                                <Ellipse Style="{StaticResource ThumbCorner}"
                                     HorizontalAlignment="Right"
                                     VerticalAlignment="Bottom" />
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style TargetType="{x:Type ControlCanvas:DesignerItem}">
            <Setter Property="MinHeight"
                Value="50" />
            <Setter Property="MinWidth"
                Value="50" />
            <Setter Property="SnapsToDevicePixels"
                Value="true" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ControlCanvas:DesignerItem}">
                        <Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=.}">
                            <Adorners:MoveThumb x:Name="PART_MoveThumb" Cursor="SizeAll" Template="{StaticResource MoveThumbTemplate}" />
                            <ContentPresenter x:Name="PART_ContentPresenter"
                                          Content="{TemplateBinding ContentControl.Content}"
                                          Margin="{TemplateBinding Padding}" />
                            <Adorners:ResizeDecorator x:Name="PART_DesignerItemDecorator" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter TargetName="PART_DesignerItemDecorator" Property="ShowDecorator" Value="True" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    
</ResourceDictionary>